<?php
	//include("csdl.php");
	function getCode($table,$codename,$len)
	{
		$kq=$knoi->queryCsdl("select max(".$codename.") as max_ma from ".$table);
		$n=mysql_fetch_array($kq);
		$max_ma=$n['max_ma'];
		if($max_ma='')
			$ma='1';
		else
		{
			$ma=1 + $max_ma;
		}
		$l=$len-count($ma);
		for($i=0;$i<$l;$i++)
		{
			$ma='0'.$ma;
		}
		//$knoi->queryCsdl("insert into ".$table." values(");
		return $ma;
	}
?>